import com.zj.config.JdbcConfig;
import com.zj.config.SpringConfig;
import com.zj.dao.UserDao;
import com.zj.service.UserService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import javax.sql.DataSource;

public class AppForAnnotation {
    public static void main(String[] args) {
        ApplicationContext ctx = new AnnotationConfigApplicationContext(SpringConfig.class);
        UserDao userDao = (UserDao) ctx.getBean("userDao");
        UserService userService = ctx.getBean(UserService.class);
        DataSource ds = ctx.getBean(DataSource.class);
//        User user= userService.selectById();
//        System.out.println(user.toString());
        System.out.println(userService.selectById().toString());
        System.out.println(userDao.selectById().toString());
        System.out.println(ds);

    }
}
